const { createLogger, format, transports } = require('winston');

// 创建日志记录器
module.exports = createLogger({
    level: 'info',
    format: format.combine(
        format.timestamp(),
        format.printf(({ timestamp, level, message }) => {
            return `${timestamp} [${level}]: ${message}`;
        })
    ),
    transports: [
        new transports.File({ filename: 'log.txt' })
    ]
});
